package com.wuyb.util;

import com.wuyb.pojo.User;
import com.wuyb.pojo.param.UserAddParam;
import com.wuyb.pojo.param.UserUpdateParam;

/**
 * User字段转换器
 *
 * @Author: wyb
 * @Date: 2024/01/03/16:40
 * @Description:
 */
public class UserParamConverter {

    public static User getUser(UserUpdateParam userUpdateParam) {
        return new User()
                .setId(userUpdateParam.getId())
                .setPassword(userUpdateParam.getPassword())
                .setName(userUpdateParam.getName())
                .setEmail(userUpdateParam.getEmail())
                .setHeadImage(userUpdateParam.getHeadImage())
                .setIsAdmin(userUpdateParam.getIsAdmin())
                .setUsername(userUpdateParam.getUsername())
                .setTelephone(userUpdateParam.getTelephone());
    }

    public static User getUser(UserAddParam userAddParam) {
        return new User()
                .setName(userAddParam.getName())
                .setPassword(userAddParam.getPassword())
                .setEmail(userAddParam.getEmail())
                .setHeadImage(userAddParam.getHeadImage())
                .setIsAdmin(userAddParam.getIsAdmin())
                .setUsername(userAddParam.getUsername())
                .setTelephone(userAddParam.getTelephone());
    }
}
